package com.injury.hunan.entity.system;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.BatchSize;

import com.injury.hunan.entity.CommonEntity;
import com.injury.hunan.entity.annotation.Comment;
import com.injury.hunan.entity.annotation.HashCodeField;

@Entity
@Table(name = "MENU")
@BatchSize(size = 10)
public class Menu extends CommonEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1446223266856004472L;

	@Id
	@Column(name = "menu_code", length = 32, updatable = false)
	@Comment("菜单编码")
	@HashCodeField(sort = 0)
	private String menuCode;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent")
	private Menu parent;

	@Column(name = "menu_name", length = 60, nullable = false)
	@Comment("菜单名")
	@HashCodeField
	private String menuName;

	@Column(name = "icon", length = 100)
	@Comment("菜单图标")
	private String icon;

	@Column(name = "url", length = 200)
	@Comment("菜单路径")
	private String url;

	/**
	 * @return the menuCode
	 */
	public String getMenuCode() {
		return menuCode;
	}

	/**
	 * @param menuCode
	 *            the menuCode to set
	 */
	public void setMenuCode(String menuCode) {
		this.menuCode = menuCode;
	}

	/**
	 * @return the parent
	 */
	public Menu getParent() {
		return parent;
	}

	/**
	 * @param parent
	 *            the parent to set
	 */
	public void setParent(Menu parent) {
		this.parent = parent;
	}

	/**
	 * @return the menuName
	 */
	public String getMenuName() {
		return menuName;
	}

	/**
	 * @param menuName
	 *            the menuName to set
	 */
	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}

	/**
	 * @return the icon
	 */
	public String getIcon() {
		return icon;
	}

	/**
	 * @param icon
	 *            the icon to set
	 */
	public void setIcon(String icon) {
		this.icon = icon;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url
	 *            the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

}
